﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PWEditor
{
    class Map
    {
        private int _rows;
        private int _cols;
        private Tile[,] _tiles;
        private List<MapObject> _mapObjects;

        public Map(int rows, int cols)
        {
            _rows = rows;
            _cols = cols;

            _tiles = new Tile[_rows, _cols];
            _mapObjects = new List<MapObject>();
        }

        public void AddObject(MapObject mapObject)
        {
            _mapObjects.Add(mapObject);  
        }

        public void SetTile(Tile tile, int row, int col)
        {
            tile.Row = row;
            tile.Col = col;
            _tiles[row-1,col-1] = tile; //_tiles is zero indexed so will subtract the row and col by one
            
        }

        public Tile GetTile(int row, int col)
        {
            return _tiles[row, col];
        }

        public Tile[,] Tiles
        {
            get { return _tiles; }
        }

        public int Cols
        {
            get { return _cols; }
        }

        public int Rows
        {
            get { return _rows; }
        }
    }
}
